package cn.spiral.role.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import cn.spiral.core.dao.impl.BaseDaoImpl;
import cn.spiral.role.dao.RoleDao;
import cn.spiral.role.entity.Role;

@Repository(value="roleDao")
public class RoleDaoImpl extends BaseDaoImpl<Role> implements RoleDao {

	@Override
	public void deleteRolePrivilegeByRoleId(String roleId) {
		//根据角色ID删除角色在RolePrivilege表中的所有权限
		Query query = getSession().createQuery("DELETE FROM RolePrivilege WHERE id.role.roleId=?");
		query.setParameter(0, roleId);
		query.executeUpdate();
	}

}
